Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
mdast-util-to-nlcst
Advanced tools
mdast utility to transform markdown into nlcst, while keeping location information intact.
In plain English: this enables natural-language tooling to read markdown as input.
Note You probably want to use remark-retext.
npm:
npm install mdast-util-to-nlcst
mdast-util-to-nlcst is also available for duo, and as an AMD, CommonJS, and globals module, uncompressed and compressed.
var toNLCST = require('mdast-util-to-nlcst');
var inspect = require('unist-util-inspect');
var remark = require('remark');
var retext = require('retext');
/*
* Process.
*/
remark().process('Some *foo*s-_ball_.', function (err, file) {
var tree = toNLCST(file, retext().Parser);
console.log(inspect(tree));
/*
* Yields:
*
* RootNode[1] (1:1-1:20, 0-19)
* └─ ParagraphNode[1] (1:1-1:20, 0-19)
* └─ SentenceNode[4] (1:1-1:20, 0-19)
* ├─ WordNode[1] (1:1-1:5, 0-4)
* │ └─ TextNode: "Some" (1:1-1:5, 0-4)
* ├─ WhiteSpaceNode: " " (1:5-1:6, 4-5)
* ├─ WordNode[4] (1:7-1:18, 6-17)
* │ ├─ TextNode: "foo" (1:7-1:10, 6-9)
* │ ├─ TextNode: "s" (1:11-1:12, 10-11)
* │ ├─ PunctuationNode: "-" (1:12-1:13, 11-12)
* │ └─ TextNode: "ball" (1:14-1:18, 13-17)
* └─ PunctuationNode: "." (1:19-1:20, 18-19)
*/
});
toNLCST(file, Parser | parser)
Transform a by remark processed virtual file into an NLCST tree for retext.
Parameters:
file
(File
)
— Virtual file, must be passed through
parse()
.
parser
(Function
or Parser
, optional)
— You can pass the (constructor of) an NLCST parser, such as
parse-english, parse-dutch,
or parse-latin.
Returns:
FAQs
mdast utility to transform to nlcst
The npm package mdast-util-to-nlcst receives a total of 82,448 weekly downloads. As such, mdast-util-to-nlcst popularity was classified as popular.
We found that mdast-util-to-nlcst demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.